feat: implemented getAccountInfoQuery TCK endpoint#2081
Conversation
Up to standards ✅🟢 Issues
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2081 +/- ##
==========================================
- Coverage 93.75% 93.72% -0.04%
==========================================
Files 145 145
Lines 9508 9507 -1
==========================================
- Hits 8914 8910 -4
- Misses 594 597 +3 🚀 New features to boost your workflow:
|
|
Hi, this is WorkflowBot.
|
4b1f574 to
4f74d1c
Compare
|
Hello, this is the OfficeHourBot. This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC). This session provides an opportunity to ask questions regarding this Pull Request. Details:
Disclaimer: This is an automated reminder. Please verify the schedule here for any changes. From, |
|
@Adityarya11, is this ready fro review |
|
btw you can delete the cahngelog please |
4f74d1c to
ca6e329
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughImplements the TCK ChangesTCK getAccountInfo feature
Query behavior and tests
Sequence DiagramsequenceDiagram
actor Client as JSON-RPC Client
participant Handler as getAccountInfo Handler
participant Params as GetAccountInfoParams
participant Query as AccountInfoQuery
participant SDK as Hiero SDK
participant Mapper as Response Mapper
Client->>Handler: JSON-RPC request (params)
Handler->>Params: parse_json_params(params)
Params-->>Handler: GetAccountInfoParams
Handler->>Query: construct AccountInfoQuery(sessionId, optional accountId)
Handler->>SDK: execute(query, client)
SDK-->>Handler: AccountInfo
Handler->>Mapper: build response from AccountInfo
Mapper-->>Handler: GetAccountInfoResponse
Handler-->>Client: JSON-RPC response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 66ae908c-c9e2-4430-a432-5bd2536963f1
📒 Files selected for processing (4)
tck/handlers/account.pytck/param/account.pytck/response/account.pytests/tck/test_account_info.py
There was a problem hiding this comment.
Pull request overview
Implements the TCK JSON-RPC getAccountInfo endpoint in the tck/ server layer, including parameter parsing, SDK query execution, and response-shape mapping aligned to the TCK spec.
Changes:
- Added
getAccountInfohandler that runsAccountInfoQueryand mapsAccountInfo→ TCK response fields. - Introduced
GetAccountInfoParamsand new account-info response dataclasses (GetAccountInfoResponse,StakingInfoResponse,TokenRelationshipResponse). - Added unit tests validating params parsing, success mapping, and error mapping for missing/invalid accountId and SDK
PrecheckError.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/tck/test_account_info.py | Adds unit tests for getAccountInfo parsing, mapping, and error behavior. |
| tck/handlers/account.py | Registers and implements getAccountInfo handler plus response-mapping helpers. |
| tck/param/account.py | Adds GetAccountInfoParams parsing for accountId + sessionId. |
| tck/response/account.py | Adds response dataclasses for account info, staking info, and token relationships. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tck/handlers/account.py (1)
177-187:⚠️ Potential issue | 🔴 CriticalMap
getAccountInfoinput/query failures to JSON-RPC errors instead of leaking exceptions.Line 183-186 currently allows missing/invalid
accountIdand SDK query failures to escape uncaught. This breaks the required error contract for missing-id, invalid-id, and precheck/error mapping paths.🐛 Proposed fix
`@rpc_method`("getAccountInfo") def get_account_info(params: GetAccountInfoParams) -> GetAccountInfoResponse: """Query account info and map SDK fields to the TCK response contract.""" client = get_client(params.sessionId) + if params.accountId is None or params.accountId == "": + raise JsonRpcError.invalid_params("accountId is required") + query = AccountInfoQuery().set_grpc_deadline(DEFAULT_GRPC_TIMEOUT) - if params.accountId is not None: - query.set_account_id(AccountId.from_string(params.accountId)) - - info = query.execute(client) + try: + query.set_account_id(AccountId.from_string(params.accountId)) + except (TypeError, ValueError) as error: + raise JsonRpcError.hiero_error( + {"status": ResponseCode.INVALID_ACCOUNT_ID.name} + ) from error + + try: + info = query.execute(client) + except PrecheckError as error: + raise JsonRpcError.hiero_error({"status": error.status.name}) from error + return _build_account_info_response(info)#!/bin/bash # Verify expected error-contract coverage and current implementation behavior. rg -n -C3 '\bdef get_account_info\b|AccountId\.from_string|query\.execute|JsonRpcError|PrecheckError|INVALID_ACCOUNT_ID|INVALID_PARAMS' tck/handlers/account.py rg -n -C3 'getAccountInfo|missing id|invalid id|deleted account|precheck|HIERO_ERROR|INVALID_PARAMS|INVALID_ACCOUNT_ID' --iglob '*test*.py'
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c36a4c45-0bec-45d1-9fa0-ba022ef09208
📒 Files selected for processing (3)
tck/handlers/account.pytck/param/account.pytck/response/account.py
manishdait
left a comment
There was a problem hiding this comment.
Nice work @Adityarya11, added some changes rest seems good to me.
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
c5d7f2d to
5d8f6d7
Compare
Up to standards ✅🟢 Issues
|
|
@hiero-ledger/hiero-sdk-python-committers review?! |
|
I can't review this right now, I don't have un-compromised hours of free time currently, i just have a few minutes/here/there |
Yeah @exploreriii |
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Signed-off-by: Adityarya11 <arya050411@gmail.com>
Description:
This PR implements the
GetAccountInfotck endpoint, to the sdk. The following code matches the tck test implementation, and the existing schema of the tck response, handler and params.Note for Reviewers:
I have taken some implementation help from the JS sdk, but the complete implementation remains valid for the python sdk.
Related issue(s):
Fixes #2040
Checklist